<template>
	<view class="page">
		<block v-if="!showDetail">
			<view v-for="(item,index) in list" :key="index" class="block" style="margin-top: 30rpx;padding: 30rpx;">
				<view class="flex-SB">
					<view class="title">问题类型</view>
					<view class="content">{{item.type}}</view>
				</view>
				<view class="flex-SB">
					<view class="title">反馈时间</view>
					<view class="content">{{$u.timeFormat(item.upload_time, 'yyyy-mm-dd hh:MM')}}</view>
				</view>
				<view class="flex-SB">
					<view class="title">详细说明</view>
					<view class="content u-line-1">{{item.content}}</view>
				</view>
				<view class="flex-SB" style="margin-bottom: 0;">
					<view class="title"></view>
					<view @click="showDetails(index)" class="details">查看详情</view>
				</view>
			</view>
		</block>
		<block v-else>
			<view  class="block" style="margin-top: 30rpx;">
				<view class="flex-SB">
					<view class="title">问题类型</view>
					<view class="content">{{showItem.type}}</view>
				</view>
				<view class="flex-SB">
					<view class="title">反馈时间</view>
					<view class="content">{{$u.timeFormat(showItem.upload_time, 'yyyy-mm-dd hh:MM')}}</view>
				</view>
				<view>
					<view class="title">详细说明</view>
					<view style="margin-top: 30rpx; white-space: wrap;">{{showItem.content}}</view>
				</view>
				<view v-if="showItem.pic" style="margin-top: 30rpx;">
					<image :src="showItem.pic"></image>
				</view>
			</view>
		</block>
	</view>
</template>

<script>
	import {mapState, mapGetters} from 'vuex'
	export default {
		computed: {
			...mapState(['member']),
		},
		data() {
			return {
				showDetail:false,
				list:[],
				showItem:{}
			};
		},
		onLoad() {
			uni.$u.http.post('/client/feedback_record',{
				phone:this.member.phone
			}).then(res=>{
				if(res.status == 200){
					let list = [];
					res.data.feedbackData.forEach(item=>{
						list.push(item)
					})
					this.list = list;
				}
			})
		},
		methods:{
			showDetails(i){
				this.showItem = this.list[i];
				this.showDetail = true
			}
		},
	}
</script>

<style lang="scss" scoped>
	.flex-SB{
		margin-bottom: 10px;
	}
	.title{
		// height: 14px;
		// line-height: 14px;
		// font-size: 14px;
		font-weight: 500;
		color: #999999;
		width: 25%;
	}
	.content{
		width: 360rpx;
		overflow: hidden;
		text-align: right;
		// white-space: nowrap;
		// text-overflow: ellipsis;
	}
	.details{
		height: 32px;
		line-height: 32px;
		font-size: 14px;
		font-weight: 500;
		color: #fff;
		text-align: center;
		border-radius: 16px;
		background-color: #01D6D6;
		width: 100px;
	}
</style>
